﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace PropertyManagment.common.lang {
	/// <summary>
	/// 返回结果实体类
	/// </summary>
    public class Result {
		/// <summary>
		/// 状态码
		/// </summary>
        public int code { get; set; }
		/// <summary>
		/// 信息
		/// </summary>
        public String msg { get; set; }
		/// <summary>
		/// 数据
		/// </summary>
		public Object data { get; set; }

		public static Result succ(Object data) {
			return succ(200, "操作成功", data);
		}

		public static Result succ(int code, String msg, Object data) {
			Result r = new Result();
			r.code = code;
			r.msg = msg;
			r.data = data;
			return r;
		}

		public static Result fail(String msg) {
			return fail(400, msg, null);
		}

		public static Result fail(int code, String msg, Object data) {
			Result r = new Result();
			r.code = code;
			r.msg = msg;
			r.data = data;
			return r;
		}

	}
}
